<?php
//SANITIZE ALL ESCAPES
$sanitize_all_escapes = true;
//
//STOP FAKE REGISTER GLOBALS
$fake_register_globals = false;
//
require_once("../../globals.php");
?>
<div id='vitals' style='padding-bottom: 5px'><!--outer div-->
    <?php
//retrieve most recent set of vitals.
    $result = sqlQuery("SELECT FORM_VITALS.date, FORM_VITALS.id FROM form_vitals AS FORM_VITALS LEFT JOIN forms AS FORMS ON FORM_VITALS.id = FORMS.form_id WHERE FORM_VITALS.pid=? AND FORMS.deleted != '1' ORDER BY FORM_VITALS.date DESC", array($pid));

    if (!$result) { //If there are no disclosures recorded
        echo "<h2>No se han ingreso signos vitales.</h2>";
    } else {
        echo "<h2>Ultima toma <span style='float: right; background-color: rgb(228, 228, 228); border-radius: 5px 5px 5px 5px; border-right: 1px solid rgb(204, 204, 204); border-width: 2px 1px 1px; border-style: solid; border-color: -moz-use-text-color rgb(204, 204, 204) rgb(204, 204, 204); -moz-border-top-colors: none; -moz-border-right-colors: none; -moz-border-bottom-colors: none; -moz-border-left-colors: none; border-image: none; padding: 0px 5px;'> " . toDateView($result["date"]) . " </span></h2>";
        include_once("report_vitals.php");
        call_user_func("vitals_report", '', '', 2, $result['id']);
        ?>
        <span class="enlace_grafico"><a href='../patient_file/encounter/trend_form.php?formname=vitals' class="enlace_grafico iframe_grafico btnNav fancybox.iframe" id='grafico'>Ver detalles</a></span>
        <?php
    }
    ?>
</div>

<script type="text/javascript" language="JavaScript">
    $(document).ready(function() {
        $('#grafico').click(function(e) {
            e.preventDefault();
            parent.$.fancybox({
                href: this.href,
                autoSize: false,
                type: 'iframe',
                helpers: {
                    overlay: {
                        opacity: 0.3,
                        css: {
                            'background': 'rgba(255, 254, 254,0.85)'
                        }
                    } // overlay
                } // helpers
            }); // fancybox
        }); // click
    });
    /********************************************************/
</script>
<!--[if lt IE 7]>
<style type='text/css'>
        #simplemodal-container a.modalCloseImg {
                background:none;
                right:-14px;
                width:22px;
                height:26px;
                filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(
                        src='img/x.png', sizingMethod='scale'
                );
        }
</style>
<![endif]-->
